package com.mall.api.client;

import com.mall.api.dto.OrderDetailDTO;
import com.mall.api.vo.ProductVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Collection;
import java.util.List;
@FeignClient("product-service")
public interface ProductClient {
    @GetMapping("/api/product/detail")
    List<ProductVO> getProductsByIds(@RequestParam("ids") Collection<Long> ids);

    @PutMapping("/api/product/deduct-stock")
    void deductStock(@RequestBody List<OrderDetailDTO> items);
}
